home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12641 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  869 b 

  1. Path: yarrina.connect.com.au!usenet
  2. From: Andrew Dalgleish <andrewd@axonet.com.au>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Dynamic Casting / RTTI
  5. Date: Thu, 21 Mar 1996 10:45:47 +1000
  6. Organization: Axon Research, Pty Ltd
  7. Message-ID: <3150A6BB.3A9C@axonet.com.au>
  8. References: <DoJF68.Mx8@news.uwindsor.ca>
  9. NNTP-Posting-Host: andrew.axonet.com.au
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I)
  14.  
  15. Saed Aryan,13325,1100,g wrote:
  16. > --- How do can I obtain a 'Deri' class pointer to the same object as pB?
  17. > sort of like: Deri * pD = dynamic_cast<Deri*>(pB);
  18. > but this yields an error:
  19. > cannot dynamic_cast `pB' (of type `class Base *') to type `class Deri 
  20.  
  21. dynamic_cast only works if the classes have virtual functions.
  22. The pointer to the rtti is stored in the vtable.
  23.  
  24. -- 
  25. Andrew Dalgleish
  26.